package com.common.event;

import java.io.Serializable;


/**
 * 
* @Title: EventMessage.java 
* @Package com.common.event
* @Description: 统一事件对象
* @author tangzhibin
* @date 2016年9月28日 
* @version V1.0
 */
public abstract class EventMessage implements Serializable{ 
	
	private static final long	serialVersionUID	= -3800746342410894327L;
	
	/**
	 * 事件key
	 */
	private String eventKey;
	
	/**事件消息id*/
	private long evnetId;
	
	/**事件创建时间*/
	private long createTime=System.currentTimeMillis();
	
	 /**
     * 消费失败后重试次数
     */
    private int retries = 0;
    
    /**
     * 每次重试间隔时间.秒【失败重试重要参数】
     */
    private int retriesIntervalSeconds;
    
    /**
     * 最后重试时间
     */
    private int lastRetriesTime;
    
    /**
     * 已经重试的次数
     */
    private int alreadyRetries = 0;
    
    /**消息传输介质策略，默认jvm事件*/
    private EventMessageStorageStrategy eventMessageStorageStrategy=EventMessageStorageStrategy.STORAGE_IN_JVM;

	public long getEvnetId() {
		return evnetId;
	}

	public void setEvnetId(long evnetId) {
		this.evnetId = evnetId;
	}

	public long getCreateTime() {
		return createTime;
	}

	public void setCreateTime(long createTime) {
		this.createTime = createTime;
	}

	public int getRetries() {
		return retries;
	}

	public void setRetries(int retries) {
		this.retries = retries;
	}

	public int getAlreadyRetries() {
		return alreadyRetries;
	}

	public void setAlreadyRetries(int alreadyRetries) {
		this.alreadyRetries = alreadyRetries;
	}

	public int getRetriesIntervalSeconds() {
		return retriesIntervalSeconds;
	}

	public void setRetriesIntervalSeconds(int retriesIntervalSeconds) {
		this.retriesIntervalSeconds = retriesIntervalSeconds;
	}

	public int getLastRetriesTime() {
		return lastRetriesTime;
	}

	public void setLastRetriesTime(int lastRetriesTime) {
		this.lastRetriesTime = lastRetriesTime;
	}
	
	public String getEventKey() {
		return eventKey;
	}

	public void setEventKey(String eventKey) {
		this.eventKey = eventKey;
	}
	

	public EventMessageStorageStrategy getEventMessageStorageStrategy() {
		return eventMessageStorageStrategy;
	}

	public void setEventMessageStorageStrategy(
			EventMessageStorageStrategy eventMessageStorageStrategy) {
		this.eventMessageStorageStrategy = eventMessageStorageStrategy;
	}

	/**需重载*/
	public abstract String toJSON();
	
}
